/**
 * Created by yuyongzhen  <1640599564@qq.com>>.
 */

module.exports = function(mod,name){
	mod.controller(name,['$scope','$routeParams','realtimestat',function($scope,$routeParams,realtimestat){
		$scope.provinces = null;
		$scope.cateories = null;

		realtimestat.getRealTimeStat($routeParams.pageno,$routeParams.pro,$routeParams.cate).then(function(ret){	
			if(ret.status == 200){
				if(ret.data.status){
					realtimestat.drawCharts($('#chart-container'),$routeParams.pro+'-'+$routeParams.cate,ret.data.data);

				}else {
					$("#chart-container").html('<div class="text-center" style="background-color:#f0f0f0;line-height: 50px;">暂无数据</div>');	
				}
				$scope.curCate = $routeParams.cate;
				$scope.curPro = $routeParams.pro;
				$scope.provinces = ret.data.ext.provinces;
				$scope.categories = ret.data.ext.categories;
			}
		});
	}]);
}

